//
//  CenterAlertView.m
//  ShrimpCrowdordering
//
//  Created by jimmy on 2018/8/28.
//  Copyright © 2018年 郑洲. All rights reserved.
//

#import "CenterAlertView.h"
#import "GKCover.h"
#import "UIView+Utils.h"

@interface CenterAlertView()


@property (nonatomic,strong)  UIButton  * cancelBtn;

@end

@implementation CenterAlertView

+(CenterAlertView *)centerAlertView//WithAlertText:(NSString *)alertText
{
    CenterAlertView * view = [[CenterAlertView alloc] init];
    view.backgroundColor = [UIColor whiteColor];
    view.layer.masksToBounds = YES;
    view.layer.cornerRadius = 6.0;
    view.gk_size = CGSizeMake(ScreenX375(300), ScreenX375(200));
//    view.alertText = alertText;
    return view;
    
}

- (instancetype)init
{
    self = [super init];
    if (self) {
        [self setViewUI];
    }
    return self;
}

- (void)setViewUI
{
    UIImageView *imageV = [[UIImageView alloc] init];
    imageV.frame = CGRectMake(ScreenX375(120), ScreenX375(30), ScreenX375(60), ScreenX375(60));
    imageV.image = [UIImage imageNamed:@"虾拼 logo"];
    [imageV setAutoresizesSubviews:true];
//    imageV.userInteractionEnabled  = true;
    [self addSubview:imageV];
    
    self.label = [[UILabel alloc] init];
    self.label.frame = CGRectMake(0, imageV.bottom+ScreenX375(10), ScreenX375(300), ScreenX375(20));
//    self.label.text = self.alertText;
    self.label.textColor = UIColorFromRGB(@"#212121", 1);
    self.label.font = Kfont(16);
    self.label.textAlignment = NSTextAlignmentCenter;
    [self addSubview:self.label];
    
    self.cancelBtn = [UIButton buttonWithType:UIButtonTypeCustom];
    self.cancelBtn.frame = CGRectMake(ScreenX375(300) - ScreenX375(25), ScreenX375(10), ScreenX375(15), ScreenX375(15));
    [self.cancelBtn setImage:[UIImage imageNamed:@"关闭"] forState:UIControlStateNormal];
    [self.cancelBtn addTarget:self action:@selector(cancelView) forControlEvents:UIControlEventTouchUpInside];
    [self addSubview:self.cancelBtn];
    
    self.seeDetailBtn = [UIButton buttonWithType:UIButtonTypeCustom];
    self.seeDetailBtn.frame = CGRectMake((ScreenX375(300)-ScreenX375(100))/2,ScreenX375(200) - ScreenX375(50), ScreenX375(100), ScreenX375(34));
    [self.seeDetailBtn setTitle:@"查看" forState:UIControlStateNormal];
    [self.seeDetailBtn setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
    self.seeDetailBtn.titleLabel.font = [UIFont systemFontOfSize:14.0];
    self.seeDetailBtn.layer.masksToBounds = YES;
    self.seeDetailBtn.layer.cornerRadius = 17.0;
    self.seeDetailBtn.backgroundColor = UIColorFromRGB(@"#fd4d4d", 1);
    [self.seeDetailBtn addTarget:self action:@selector(seeMore) forControlEvents:UIControlEventTouchUpInside];
    [self addSubview:self.seeDetailBtn];
    
    
}

-(void)cancelView
{
    [GKCover hideView];
}

- (void)seeMore
{
    if (_seeMoreBlock) {
        _seeMoreBlock();
    }
}

@end
